package com.liuweiheng.base.enums;

import cn.hutool.core.util.ObjectUtil;

import java.util.Arrays;

/**
 * 用户状态枚举类
 *
 * @author lwh
 */
public enum UserStatusEnum {
    /**
     * 待激活
     */
    NOT_ACTIVED(0, "待激活");

    private Integer status;
    private String statusStr;


    UserStatusEnum(Integer status, String statusStr) {
        this.status = status;
        this.statusStr = statusStr;
    }

    /**
     * 获取状态信息
     * @return 状态对应信息
     */
    public static String getStatusStr(Integer status) {
        if (ObjectUtil.isNull(status)) {
            return null;
        }

        UserStatusEnum
                userStatusEnum = Arrays.stream(values()).filter(resource -> resource.status.equals(status)).findFirst().orElse(null);

        if (ObjectUtil.isNotNull(userStatusEnum)) {
            return userStatusEnum.statusStr;
        }

        return null;
    }

    public Integer getStatus() {
        return status;
    }
}



